package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                        import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.RepaymentExceptionMapper;
import com.ruoyi.bizsys.domain.RepaymentException;
import com.ruoyi.bizsys.service.IRepaymentExceptionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 还款异常记录Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class RepaymentExceptionServiceImpl extends ServiceImpl<RepaymentExceptionMapper,RepaymentException> implements IRepaymentExceptionService {

    /**
     * 查询还款异常记录
     *
     * @param id 还款异常记录ID
     * @return 还款异常记录
     */
    @Override
    public RepaymentException selectRepaymentExceptionById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询还款异常记录列表
     *
     * @param repaymentException 还款异常记录
     * @return 还款异常记录
     */
    @Override
    public List<RepaymentException> selectRepaymentExceptionList(RepaymentException repaymentException) {
        return this.list(new QueryWrapper<>(repaymentException).last("order by id desc"));
    }

    /**
     * 新增还款异常记录
     *
     * @param repaymentException 还款异常记录
     * @return 结果
     */
            @Override
    public int insertRepaymentException(RepaymentException repaymentException) {
                                                                                                                                                                                repaymentException.setCreateTime(DateUtils.getNowDate());
                                                return baseMapper.insert(repaymentException);
    }

    /**
     * 修改还款异常记录
     *
     * @param repaymentException 还款异常记录
     * @return 结果
     */
            @Override
    public int updateRepaymentException(RepaymentException repaymentException) {
                                                                                                                                                                                                    repaymentException.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(repaymentException);
    }

    /**
     * 批量删除还款异常记录
     *
     * @param ids 需要删除的还款异常记录ID
     * @return 结果
     */
            @Override
    public int deleteRepaymentExceptionByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除还款异常记录信息
     *
     * @param id 还款异常记录ID
     * @return 结果
     */
    @Override
    public int deleteRepaymentExceptionById(Long id) {
        return baseMapper.deleteById(id);
    }

}
